<template>
  <div>
    <div class="chance">
      <div class="select">
        <el-select v-model="value">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
        <div class="block">
          <el-date-picker v-model="value1" type="year" placeholder="选择年">
          </el-date-picker>
        </div>
        <div class="block">
          <el-date-picker v-model="value2" type="month" placeholder="选择月">
          </el-date-picker>
        </div>
      </div>
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        class="query-form"
      >
        <el-form-item>
          <el-input
            v-model="queryParams.employeeTel"
            placeholder="支持姓名、工号、手机号搜索"
            clearable
            size="small"
            @keyup.enter.native="searchMethod"
          >
          <i slot="suffix" class="el-input__icon el-icon-search"></i>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="mini">导出</el-button>
          <el-button
            type="primary"
            @click="add()"
            size="mini"
            v-hasPermi="['employee:employee:add']"
            >导入</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="context">
      <div class="table">
        <el-table :data="tableData" style="width: 100%" v-if="value=='月工资项'">
          <el-table-column type="index" label="序号"> </el-table-column>
          <el-table-column v-for="item in tableColsMouth" :key="item.label" :sortable="item.sortable" :label="item.label" :prop="item.prop"></el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button @click="transfer(scope.row)" type="text" size="small"
                >移交</el-button
              >
              <el-button type="text" size="small" @click="edit(scope.row)"
                >修改</el-button
              >
            </template>
          </el-table-column>
          <el-table-column align="center" width="50">
            <template slot="header">
              <el-popover placement="bottom-start" width="100" trigger="click">
                <el-checkbox-group v-model="checkedTableColumns">
                  <div style="display: flex; flex-direction: column">
                    <el-checkbox label="选项">选项</el-checkbox>
                  </div>
                </el-checkbox-group>
                <i
                  class="el-icon-s-tools"
                  @click="clickReset"
                  style="font-size: 25px"
                  slot="reference"
                ></i>
              </el-popover>
            </template>
          </el-table-column>
        </el-table>
        <el-table :data="tableData" style="width: 100%" v-else>
          <el-table-column type="index" label="序号"> </el-table-column>
          <el-table-column v-for="item in tableColsOther" :key="item.label" :sortable="item.sortable" :label="item.label" :prop="item.prop"></el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button @click="transfer(scope.row)" type="text" size="small"
                >移交</el-button
              >
              <el-button type="text" size="small" @click="edit(scope.row)"
                >修改</el-button
              >
            </template>
          </el-table-column>
          <el-table-column align="center" width="50">
            <template slot="header">
              <el-popover placement="bottom-start" width="100" trigger="click">
                <el-checkbox-group v-model="checkedTableColumns">
                  <div style="display: flex; flex-direction: column">
                    <el-checkbox label="选项">选项</el-checkbox>
                  </div>
                </el-checkbox-group>
                <i
                  class="el-icon-s-tools"
                  @click="clickReset"
                  style="font-size: 25px"
                  slot="reference"
                ></i>
              </el-popover>
            </template>
          </el-table-column>
        </el-table>
        <edit
          v-if="editDialog"
          :editDialog="editDialog"
          @close="closeEdit"
        ></edit>
        <transfer
          v-if="transferDialog"
          :transferDialog="transferDialog"
          @close="closeTransfer"
        ></transfer>
      </div>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="100"
        background=""
        layout="total, sizes, prev, pager, next, jumper"
        :total="20"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import edit from "./edit.vue";
import transfer from "./transfer.vue";
export default {
  name: "salaryFile",
  components: {
    edit,
    transfer,
  },
  data() {
    return {
        options: [{
          value: '月工资项',
          label: '月工资项'
        }, {
          value: '其他工资项',
          label: '其他工资项'
        },],
        value:'月工资项',
      value1: "",
      value2: "",
      transferDialog: false,
      editDialog: false,
      queryParams: {
        employeeCode: null,
        employeeName: null,
        employeeTel: null,
        employeeJoinStatus: null,
        employeeFormalStatus: null,
        employeeLeaveStatus: null,
        employeeRetiredStatus: null,
      },
      tableData: [
        {
          id: "12987122",
          name: "王小虎",
          amount1: "234",
          amount2: "3.2",
          amount3: 10,
        },
        {
          id: "12987122",
          name: "王小虎",
          amount1: "234",
          amount2: "3.2",
          amount3: 10,
        },
        {
          id: "12987122",
          name: "王小虎",
          amount1: "234",
          amount2: "3.2",
          amount3: 10,
        },
      ],
      tableColsMouth:[
        {prop:"id",
        label:"工号",
        sortable:true,
        },
        {prop:"name",
        label:"中文姓名",
        sortable:true,
        },
        {prop:"amount1",
        label:"薪级",
        sortable:false,
        },
        {prop:"amount2",
        label:"岗位职级",
        sortable:false,
        },
        {prop:"amount3",
        label:"在职状态",
        sortable:false,
        },
        {prop:"amount1",
        label:"基本工资",
        sortable:false,
        },
        {prop:"amount1",
        label:"校龄津贴",
        sortable:false,
        },
        {prop:"amount3",
        label:"交通补贴",
        sortable:false,
        },
        {prop:"amount1",
        label:"误餐补贴",
        sortable:false,
        },
        {prop:"amount2",
        label:"住房补贴",
        sortable:false,
        },
        {prop:"amount3",
        label:"通讯补贴",
        sortable:false,
        },
        {prop:"amount1",
        label:"岗位津贴",
        sortable:false,
        },
        {prop:"amount2",
        label:"信息安全与保密补贴",
        sortable:false,
        },
        {prop:"amount3",
        label:"应发月工资金额",
        sortable:false,
        },{prop:"amount1",
        label:"方案名称",
        sortable:false,
        },
        {prop:"amount2",
        label:"目前状态",
        sortable:false,
        },
        
      ],
      tableColsOther:[
        {prop:"id",
        label:"工号",
        sortable:true,
        },
        {prop:"name",
        label:"中文姓名",
        sortable:true,
        },
        {prop:"amount1",
        label:"所属组织",
        sortable:false,
        },
        {prop:"amount2",
        label:"薪级",
        sortable:false,
        },
        {prop:"amount3",
        label:"岗位职级",
        sortable:false,
        },
        {prop:"amount1",
        label:"在职状态",
        sortable:false,
        },
        {prop:"amount1",
        label:"节日慰问",
        sortable:false,
        },
        {prop:"amount3",
        label:"奖金",
        sortable:false,
        },
        {prop:"amount3",
        label:"应发月工资金额",
        sortable:false,
        },{prop:"amount1",
        label:"方案名称",
        sortable:false,
        },
        {prop:"amount2",
        label:"目前状态",
        sortable:false,
        },
        
      ]
    };
  },
  methods: {
    clickReset() {
      this.reset = !this.reset;
    },
    resetQuery() {
      this.queryParams = {
        employeeCode: null,
        employeeName: null,
        employeeTel: null,
        employeeStatus: "2",
        size: 10,
        current: 1,
      };
      this.getPageList();
    },
    // 翻页
    handleCurrentChange(val) {
      this.queryParams.current = val;
      this.getPageList();
    },
    // 移交弹窗
    transfer() {
      this.transferDialog = true;
    },
    closeTransfer(params) {
      this.transferDialog = params;
    },
    // 修改弹窗
    edit() {
      this.editDialog = true;
    },
    closeEdit(params) {
      this.editDialog = params;
    },
  },
};
</script>

<style lang="scss" scoped>
.el-table {
  margin-top: 20px;
}
.el-tabs {
  margin: 0 20px;
}
.el-tabs__item {
  font-size: 16px;
  font-weight: bold;
}
.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.chance {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.context {
  padding-left: 20px;
}
.el-select{
  width: 120px;
}
.select {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.select .el-dropdown-link {
  color: black;
  border: 1px solid #ccc;
  padding: 10px;
  margin-right: 20px;
  border-radius: 5px;
}
.el-date-editor {
  width: 120px;
  margin:0 10px;
}
.el-pagination {
  margin-top: 20px;
  float: right;
}
</style>

